Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphology-utils

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphology-utils

Miscellaneous utils for graphology.

  • 2.5.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
287K
decreased by-4.61%
Maintainers
1
Weekly downloads
 
Created

What is graphology-utils?

The graphology-utils npm package provides a set of utility functions for working with graphology, a JavaScript library for manipulating and analyzing graphs. These utilities help in performing common graph operations such as traversal, manipulation, and analysis.

What are graphology-utils's main functionalities?

Graph Traversal

This feature allows you to traverse through all nodes in a graph and perform operations on them. The code sample demonstrates how to use the `forEachNode` utility to log each node and its attributes.

const { forEachNode } = require('graphology-utils');
const Graph = require('graphology');

const graph = new Graph();
graph.addNode('John');
graph.addNode('Martha');
graph.addEdge('John', 'Martha');

forEachNode(graph, (node, attributes) => {
  console.log(node, attributes);
});

Graph Manipulation

This feature allows you to merge multiple graphs into one. The code sample demonstrates how to use the `mergeGraphs` utility to combine two graphs into a single graph.

const { mergeGraphs } = require('graphology-utils');
const Graph = require('graphology');

const graph1 = new Graph();
graph1.addNode('Alice');
const graph2 = new Graph();
graph2.addNode('Bob');

const mergedGraph = mergeGraphs(graph1, graph2);
console.log(mergedGraph.nodes());

Graph Analysis

This feature allows you to perform analysis on the graph, such as calculating the degree of a node. The code sample demonstrates how to use the `degree` utility to find the degree of a node named 'Alice'.

const { degree } = require('graphology-utils');
const Graph = require('graphology');

const graph = new Graph();
graph.addNode('Alice');
graph.addNode('Bob');
graph.addEdge('Alice', 'Bob');

const aliceDegree = degree(graph, 'Alice');
console.log(aliceDegree);

Other packages similar to graphology-utils

Keywords

FAQs

Package last updated on 07 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc